<template>
	<!-- 服务发布页面 -->
	<view class="serve-container">
		<!-- 服务名称输入和步骤指引 -->
		<view class="main-card">
			<view class="input-container">
				<text class="label">{{keyTitle}}名称：</text>
				<input type="text" class="input" :placeholder="`请输入${keyTitle}名称`" v-model="serviceName" />
			</view>

			<!-- 封面上传 -->
			<view class="cover-upload">
				<view class="cover-header">
					<text class="label">{{keyTitle}}封面：</text>
					<text class="hint">（建议尺寸: 750 x 422，会显示在{{keyTitle}}列表中）</text>
				</view>
				<view class="cover-container" @click="uploadCover">
					<image class="cover-image" v-if="coverImage" :src="coverImage" mode="aspectFill"></image>
					<view class="delete-cover" v-if="coverImage" @click.stop="deleteCover">
						<text class="iconfont icon-shanchu" style="font-size: 32rpx;"></text>
					</view>
					<view class="upload-cover-box" v-else>
						<text class='iconfont icon-icon25201' style="font-size: 60rpx;"></text>
						<text class="upload-text">上传封面</text>
					</view>
				</view>
			</view>

			<!-- 步骤指引 -->
			<view class="step-container">
				<view class="step-item" :class="{ active: activeTab === 0, completed: steps[0].completed }">
					<view class="step-circle">{{ steps[0].completed ? '✓' : '1' }}</view>
					<text class="step-text">{{keyTitle}}描述</text>
					<view class="step-line" v-if="activeTab > 0 || steps[0].completed"></view>
				</view>
				<view class="step-item" :class="{ active: activeTab === 1, completed: steps[1].completed }">
					<view class="step-circle">{{ steps[1].completed ? '✓' : '2' }}</view>
					<text class="step-text">{{keyTitle}}案例</text>
					<view class="step-line" v-if="activeTab > 1 || steps[1].completed"></view>
				</view>
				<view class="step-item" :class="{ active: activeTab === 2, completed: steps[2].completed }">
					<view class="step-circle">{{ steps[2].completed ? '✓' : '3' }}</view>
					<text class="step-text">{{keyTitle}}资质</text>
				</view>
			</view>

		</view>

		<!-- 内容区域 -->
		<view class="main-card content-wrapper">

			<!-- 选项卡 -->
			<view class="tab-container">
				<view class="tab-item" :class="{ active: activeTab === 0 }" @click="changeTab(0)">
					<text>{{keyTitle}}描述</text>
					<view class="tab-line blue-line"></view>
				</view>
				<view class="tab-item" :class="{ active: activeTab === 1 }" @click="changeTab(1)">
					<text>{{keyTitle}}案例</text>
					<view class="tab-line red-line"></view>
				</view>
				<view class="tab-item" :class="{ active: activeTab === 2 }" @click="changeTab(2)">
					<text>{{keyTitle}}资质</text>
					<view class="tab-line green-line"></view>
				</view>
			</view>

			<!-- 服务描述内容 -->
			<view class="content-container" v-if="activeTab === 0">

				<view class="content-title">
					<view class="title-line"></view>
					<text class="title-text">{{keyTitle}}描述 (步骤1/3)</text>
					<view class="title-line"></view>
				</view>

				<view class="hint-text">请填写您的{{keyTitle}}描述，帮助用户了解您的{{keyTitle}}内容</view>

				<view class="text-area-container">
					<textarea maxlength="1000" class="text-area" :placeholder="`请输入你的${keyTitle}信息`"
						v-model="formData.description" />
				</view>

				<view class="upload-container">
					<drag-image :number="6" :borderRadius="12" v-model="formData.descriptionImages"
						:addImage="addImages">
						<template v-slot:upload>
							<view class="upload-box" @click="uploadImage(0)">
								<text class='iconfont icon-icon25201' style="font-size: 60rpx;"></text>
								<text class="upload-text">上传图片</text>
							</view>
						</template>
					</drag-image>
				</view>

				<view class="next-btn" @click="nextStep">
					<text>下一步</text>
				</view>
			</view>

			<!-- 服务案例内容 -->
			<view class="content-container" v-if="activeTab === 1">
				<view class="content-title">
					<view class="title-line"></view>
					<text class="title-text">{{keyTitle}}案例 (步骤2/3)</text>
					<view class="title-line"></view>
				</view>

				<view class="hint-text">请分享您的{{keyTitle}}案例，展示您的专业能力</view>

				<view class="text-area-container">
					<textarea maxlength="1000" class="text-area" :placeholder="`请输入你的${keyTitle}案例`"
						v-model="formData.cases" />
				</view>


				<view class="upload-container">
					<drag-image :number="6" :borderRadius="12" v-model="formData.casesImages" :addImage="addImages">
						<template v-slot:upload>
							<view class="upload-box" @click="uploadImage(1)">
								<text class='iconfont icon-icon25201' style="font-size: 60rpx;"></text>
								<text class="upload-text">上传图片</text>
							</view>
						</template>
					</drag-image>
				</view>

				<view class="btn-group">
					<view class="prev-btn" @click="prevStep">
						<text>上一步</text>
					</view>
					<view class="next-btn" @click="nextStep">
						<text>下一步</text>
					</view>
				</view>
			</view>

			<!-- 服务资质内容 -->
			<view class="content-container" v-if="activeTab === 2">
				<view class="content-title">
					<view class="title-line"></view>
					<text class="title-text">{{keyTitle}}资质 (步骤3/3)</text>
					<view class="title-line"></view>
				</view>

				<view class="hint-text">请提供您的专业资质证明(如公司信息等)，增加用户信任度</view>

				<view class="text-area-container">
					<textarea maxlength="1000" class="text-area" :placeholder="`请输入你的${keyTitle}资质`"
						v-model="formData.qualification" />
				</view>

				<view class="upload-container">
					<drag-image :number="6" :borderRadius="12" v-model="formData.qualificationImages"
						:addImage="addImages">
						<template v-slot:upload>
							<view class="upload-box" @click="uploadImage(2)">
								<text class='iconfont icon-icon25201' style="font-size: 60rpx;"></text>
								<text class="upload-text">上传图片</text>
							</view>
						</template>
					</drag-image>
				</view>

				<view class="btn-group">
					<view class="prev-btn" @click="prevStep">
						<text>上一步</text>
					</view>
					<view class="complete-btn" @click="submitForm">
						<text>提交审核</text>
					</view>
				</view>
			</view>
		</view>

		<!-- 进度提示 -->
		<view class="main-card">
			<view class="progress-container">
				<view class="progress-text">完成度: {{ completionRate }}%</view>
				<view class="progress-text-detail" v-if="completionRate < 100">
					<text>每个模块填写文字或上传图片即可</text>
				</view>
				<view class="progress-bar">
					<view class="progress-fill" :style="{width: completionRate + '%'}"></view>
				</view>
				<view class="progress-details">
					<view class="progress-item" :class="{ completed: serviceName }">
						<view class="progress-dot"></view>
						<text>{{keyTitle}}名称</text>
					</view>
					<view class="progress-item" :class="{ completed: coverImage }">
						<view class="progress-dot"></view>
						<text>{{keyTitle}}封面</text>
					</view>
					<view class="progress-item"
						:class="{ completed: formData.description || formData.descriptionImages.length > 0 }">
						<view class="progress-dot"></view>
						<text>{{keyTitle}}描述</text>
					</view>
					<view class="progress-item"
						:class="{ completed: formData.cases || formData.casesImages.length > 0 }">
						<view class="progress-dot"></view>
						<text>{{keyTitle}}案例</text>
					</view>
					<view class="progress-item"
						:class="{ completed: formData.qualification || formData.qualificationImages.length > 0 }">
						<view class="progress-dot"></view>
						<text>{{keyTitle}}资质</text>
					</view>
				</view>
			</view>

			<!-- 底部按钮 -->
			<view class="btn-container">
				<view class="btn cancel-btn" @click="cancel">
					<text>取消</text>
				</view>
				<view class="btn save-btn" @click="saveAsDraft">
					<text>保存草稿</text>
				</view>
			</view>
		</view>

		<!-- 提示弹窗 -->
		<view class="modal" v-if="showModal">
			<view class="modal-content">
				<view class="modal-title">{{ modalTitle }}</view>
				<view class="modal-message">{{ modalMessage }}</view>
				<view class="modal-btn" @click="closeModal">确定</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		findServiceSave,
		findServiceGetDetail
	} from "@/api/extend.js"
	import dragImage from '@/pages/extend/components/shmily-drag-image/components/shmily-drag-image/shmily-drag-image.vue'

	export default {
		components: {
			dragImage
		},
		data() {
			return {
				keyTitle: '服务',
				options: {},
				activeTab: 0,
				serviceName: '',
				formData: {
					description: '',
					descriptionImages: [],
					cases: '',
					casesImages: [],
					qualification: '',
					qualificationImages: []
				},
				steps: [{
						completed: false
					},
					{
						completed: false
					},
					{
						completed: false
					}
				],
				showModal: false,
				modalTitle: '',
				modalMessage: '',
				coverImage: ''
			}
		},
		computed: {
			completionRate() {
				let count = 0;
				const totalSteps = 5; // 总共5个步骤：服务名称 + 服务封面 + 3个模块

				// 服务名称检查
				if (this.serviceName) count += 1;

				// 服务封面检查
				if (this.coverImage) count += 1;

				// 检查服务描述模块 - 文字或图片任一填写即可
				if (this.formData.description || this.formData.descriptionImages.length > 0) {
					count += 1;
				}

				// 检查服务案例模块 - 文字或图片任一填写即可
				if (this.formData.cases || this.formData.casesImages.length > 0) {
					count += 1;
				}

				// 检查服务资质模块 - 文字或图片任一填写即可
				if (this.formData.qualification || this.formData.qualificationImages.length > 0) {
					count += 1;
				}

				// 计算百分比并返回
				return Math.round((count / totalSteps) * 100);
			},
			// 检查每个模块的完成状态
			moduleStatus() {
				return {
					module1: this.formData.description || this.formData.descriptionImages.length > 0,
					module2: this.formData.cases || this.formData.casesImages.length > 0,
					module3: this.formData.qualification || this.formData.qualificationImages.length > 0
				};
			}
		},
		watch: {
			// 监听模块状态变化，更新步骤完成状态
			moduleStatus: {
				handler(newVal) {
					this.steps[0].completed = newVal.module1;
					this.steps[1].completed = newVal.module2;
					this.steps[2].completed = newVal.module3;
				},
				deep: true
			}
		},
		onLoad(options) {
			this.options = options;

			let title = '';
			if (options.type == 2) {
				title = '找专家'
				this.keyTitle = '专家'
			} else if (options.type == 3) {
				title = '找项目'
				this.keyTitle = '项目'
			} else if (options.type == 4) {
				title = '找资金'
				this.keyTitle = '服务'
			} else {
				title = '找服务'
			}

			uni.setNavigationBarTitle({
				title: title
			})

			if (options.id) {
				findServiceGetDetail({
					id: options.id
				}).then(res => {
					if (res.status == 200 && res.data) {
						// 填充表单数据
						this.serviceName = res.data.title || '';
						this.coverImage = res.data.cover_image || '';
						this.formData.description = res.data.des_content || '';
						this.formData.descriptionImages = res.data.des_images ? res.data.des_images.split(',') :
					[];
						this.formData.cases = res.data.case_content || '';
						this.formData.casesImages = res.data.case_images ? res.data.case_images.split(',') : [];
						this.formData.qualification = res.data.qua_content || '';
						this.formData.qualificationImages = res.data.qua_images ? res.data.qua_images.split(',') :
							[];
					} else {
						uni.showToast({
							title: '获取服务详情失败',
							icon: 'none'
						});
					}
				}).catch(err => {
					uni.showToast({
						title: '获取服务详情失败',
						icon: 'none'
					});
					console.error('获取服务详情失败', err);
				})
				return
			}


			// 检查是否有保存的草稿
			uni.getStorage({
				key: 'serviceDraft',
				success: (res) => {
					if (res.data) {
						const draftData = res.data;

						// 提示用户是否恢复草稿
						uni.showModal({
							title: '发现草稿',
							content: '是否恢复上次保存的草稿？',
							confirmText: '恢复',
							cancelText: '不需要',
							success: (result) => {
								if (result.confirm) {
									// 恢复草稿数据
									this.serviceName = draftData.serviceName || '';
									this.coverImage = draftData.coverImage || '';
									this.formData.description = draftData.description || '';
									this.formData.descriptionImages = draftData
										.descriptionImages || [];
									this.formData.cases = draftData.cases || '';
									this.formData.casesImages = draftData.casesImages || [];
									this.formData.qualification = draftData.qualification || '';
									this.formData.qualificationImages = draftData
										.qualificationImages || [];

									// 显示恢复成功提示
									uni.showToast({
										title: '草稿已恢复',
										icon: 'success'
									});
								} else {
									// 用户选择不恢复，清除草稿
									uni.removeStorage({
										key: 'serviceDraft'
									});
								}
							}
						});
					}
				}
			});
		},
		methods: {
			changeTab(index) {
				// 添加动画效果
				if (this.activeTab !== index) {
					this.activeTab = index;
				}
			},
			nextStep() {
				if (this.activeTab === 0) {
					// 检查服务描述模块 - 文字或图片任一填写即可
					if (!this.formData.description && this.formData.descriptionImages.length === 0) {
						this.showTip('提示', '请填写服务描述或上传图片');
						return;
					}

					this.steps[0].completed = true;
				} else if (this.activeTab === 1) {
					// 检查服务案例模块 - 文字或图片任一填写即可
					if (!this.formData.cases && this.formData.casesImages.length === 0) {
						this.showTip('提示', '请填写服务案例或上传图片');
						return;
					}

					this.steps[1].completed = true;
				}
				if (this.activeTab < 2) {
					this.activeTab++;
				}
			},
			prevStep() {
				if (this.activeTab > 0) {
					this.activeTab--;
				}
			},
			uploadImage(index) {
				// 检查上传数量限制
				let currentList;
				if (index === 0) {
					currentList = this.formData.descriptionImages;
					if (currentList.length >= 6) {
						uni.showToast({
							title: '最多只能上传6张图片',
							icon: 'none'
						})
						return;
					}
				} else if (index === 1) {
					currentList = this.formData.casesImages;
					if (currentList.length >= 6) {
						uni.showToast({
							title: '最多只能上传6张图片',
							icon: 'none'
						})
						return;
					}
				} else {
					currentList = this.formData.qualificationImages;
					if (currentList.length >= 6) {
						uni.showToast({
							title: '最多只能上传6张图片',
							icon: 'none'
						})
						return;
					}
				}

				// 使用统一的上传工具
				this.$util.uploadImageOne({
					url: 'upload/image',
					count: 6
				}, (res) => {
					if (Array.isArray(res)) {
						if (index === 0) {
							this.formData.descriptionImages = [...this.formData.descriptionImages, ...res];
						} else if (index === 1) {
							this.formData.casesImages = [...this.formData.casesImages, ...res];
						} else {
							this.formData.qualificationImages = [...this.formData.qualificationImages, ...res];
						}
					}
				});
			},
			addImages() {
				// 根据当前激活的选项卡来确定是哪个上传区域
				let index = this.activeTab;
				this.uploadImage(index);
			},
			submitForm() {
				if (!this.serviceName) {
					this.showTip('提示', '请输入服务名称');
					return;
				}

				if (!this.coverImage) {
					this.showTip('提示', '请上传服务封面');
					return;
				}

				// 检查服务描述模块 - 文字或图片任一填写即可
				if (!this.formData.description && this.formData.descriptionImages.length === 0) {
					this.showTip('提示', '请填写服务描述或上传图片');
					this.activeTab = 0;
					return;
				}

				// 检查服务案例模块 - 文字或图片任一填写即可
				if (!this.formData.cases && this.formData.casesImages.length === 0) {
					this.showTip('提示', '请填写服务案例或上传图片');
					this.activeTab = 1;
					return;
				}

				// 检查服务资质模块 - 文字或图片任一填写即可
				if (!this.formData.qualification && this.formData.qualificationImages.length === 0) {
					this.showTip('提示', '请填写服务资质或上传图片');
					this.activeTab = 2;
					return;
				}

				this.steps[2].completed = true;

				// 模拟提交
				uni.showLoading({
					title: '提交中...'
				});

				// 后端接口提交

				findServiceSave({
					type: this.options.type || null,
					id: this.options.id || null, //没有时为创建
					title: this.serviceName, // 标题
					cover_image: this.coverImage, //封面
					des_content: this.formData.description, //服务描述
					des_images: this.formData.descriptionImages.join(','), //服务描述图片地址
					case_content: this.formData.cases, //服务案例
					case_images: this.formData.casesImages.join(','), //服务案例图片地址
					qua_content: this.formData.qualification, //服务资质
					qua_images: this.formData.qualificationImages.join(','), //资质图片
				}).then(res => {
					uni.hideLoading();
					if (res.status == 200) {
						// 清除草稿
						uni.removeStorage({
							key: 'serviceDraft'
						});

						uni.showToast({
							title: '提交成功',
							icon: 'success',
							duration: 2000,
							success: () => {
								setTimeout(() => {
									uni.redirectTo({
										url: '/pages/extend/index/index_serve_manage?type=' +
											this.options.type
									})
								}, 2000);
							}
						});
					} else {
						uni.showToast({
							title: res.message || '提交失败',
							icon: 'none'
						});
					}
				}).catch(err => {
					uni.hideLoading();
					uni.showToast({
						title: '提交失败，请稍后重试',
						icon: 'none'
					});
					console.error('服务提交失败', err);
				})


			},
			saveAsDraft() {
				// 创建草稿数据对象
				const draftData = {
					serviceName: this.serviceName,
					coverImage: this.coverImage,
					description: this.formData.description,
					descriptionImages: this.formData.descriptionImages,
					cases: this.formData.cases,
					casesImages: this.formData.casesImages,
					qualification: this.formData.qualification,
					qualificationImages: this.formData.qualificationImages,
					completionRate: this.completionRate,
					timestamp: new Date().getTime()
				};

				// 保存到本地存储
				uni.setStorage({
					key: 'serviceDraft',
					data: draftData,
					success: () => {
						uni.showToast({
							title: '已保存草稿',
							icon: 'success'
						});
					},
					fail: (err) => {
						console.error('保存草稿失败', err);
						uni.showToast({
							title: '保存失败',
							icon: 'none'
						});
					}
				});
			},
			cancel() {
				if (this.completionRate > 0) {
					uni.showModal({
						title: '提示',
						content: '是否放弃当前编辑？',
						confirmText: '放弃',
						cancelText: '继续编辑',
						success: (res) => {
							if (res.confirm) {
								// 清除草稿并返回
								uni.removeStorage({
									key: 'serviceDraft',
									complete: () => {
										uni.navigateBack();
									}
								});
							}
						}
					});
				} else {
					uni.navigateBack();
				}
			},
			showTip(title, message) {
				this.modalTitle = title;
				this.modalMessage = message;
				this.showModal = true;
			},
			closeModal() {
				this.showModal = false;
			},
			uploadCover() {
				// 实现封面上传逻辑
				this.$util.uploadImageOne({
					url: 'upload/image',
					count: 1
				}, (res) => {
					if (Array.isArray(res) && res.length > 0) {
						this.coverImage = res[0];
						uni.showToast({
							title: '封面上传成功',
							icon: 'success'
						});
					} else if (res && res.data && res.data.path) {
						// 当count=1时，返回的是一个对象，包含data.path
						this.coverImage = res.data.path;
						uni.showToast({
							title: '封面上传成功',
							icon: 'success'
						});
					} else {
						uni.showToast({
							title: '上传失败',
							icon: 'none'
						});
					}
				});
			},
			deleteCover() {
				uni.showModal({
					title: '提示',
					content: '确定要删除封面吗？',
					success: (res) => {
						if (res.confirm) {
							this.coverImage = '';
							uni.showToast({
								title: '封面已删除',
								icon: 'success'
							});
						}
					}
				});
			}
		}
	}
</script>

<style scoped lang="scss">
	.serve-container {
		padding: 30rpx;
		background-color: #f8f9fd;
		min-height: 100vh;
	}

	@keyframes fade-in {
		from {
			opacity: 0;
			transform: translateY(10rpx);
		}

		to {
			opacity: 1;
			transform: translateY(0);
		}
	}

	.main-card {
		background-color: #fff;
		border-radius: 16rpx;
		box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.05);
		margin-bottom: 30rpx;
		padding: 30rpx;
		overflow: hidden;
	}

	.input-container {
		display: flex;
		align-items: center;
		margin-bottom: 30rpx;

		.label {
			font-size: 30rpx;
			color: #333;
			margin-right: 20rpx;
			font-weight: 500;
		}

		.input {
			flex: 1;
			height: 70rpx;
			font-size: 28rpx;
			color: #333;
			background-color: #f5f7fa;
			border-radius: 8rpx;
			padding: 0 20rpx;

			&::placeholder {
				color: #a0a9b6;
			}
		}
	}

	.cover-upload {
		margin-bottom: 30rpx;
		margin-top: 20rpx;

		.cover-header {
			display: flex;
			align-items: center;
			margin-bottom: 16rpx;

			.label {
				font-size: 30rpx;
				color: #333;
				font-weight: 500;
			}

			.hint {
				font-size: 24rpx;
				color: #909399;
				margin-left: 10rpx;
			}
		}

		.cover-container {
			width: 300rpx;
			height: 180rpx;
			border: 2rpx dashed #dcdfe6;
			border-radius: 12rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			background-color: #f5f7fa;
			transition: all 0.3s;
			overflow: hidden;
			position: relative;

			&:active {
				transform: scale(0.98);
			}

			.cover-image {
				width: 100%;
				height: 100%;
				object-fit: cover;
			}

			.delete-cover {
				position: absolute;
				top: 10rpx;
				right: 10rpx;
				width: 48rpx;
				height: 48rpx;
				background-color: rgba(0, 0, 0, 0.5);
				color: #fff;
				border-radius: 24rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				z-index: 2;
			}

			.upload-cover-box {
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				width: 100%;
				height: 100%;

				.upload-text {
					font-size: 24rpx;
					color: #909399;
					margin-top: 8rpx;
				}
			}
		}
	}

	.step-container {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 20rpx 0;
		margin-bottom: 10rpx;
		border-top: 1rpx solid #f0f2f5;
		// border-bottom: 1rpx solid #f0f2f5;

		.step-item {
			display: flex;
			flex-direction: column;
			align-items: center;
			position: relative;
			flex: 1;

			.step-circle {
				width: 60rpx;
				height: 60rpx;
				border-radius: 30rpx;
				background-color: #f5f7fa;
				color: #909399;
				display: flex;
				justify-content: center;
				align-items: center;
				font-size: 28rpx;
				margin-bottom: 15rpx;
				border: 2rpx solid #e4e7ed;
				z-index: 2;
			}

			.step-text {
				font-size: 26rpx;
				color: #909399;
			}

			.step-line {
				position: absolute;
				top: 30rpx;
				left: 50%;
				width: 100%;
				height: 2rpx;
				background-color: #e4e7ed;
				z-index: 1;
			}

			&.active {
				.step-circle {
					background-color: #1890ff;
					color: #fff;
					border-color: #1890ff;
				}

				.step-text {
					color: #1890ff;
					font-weight: 500;
				}
			}

			&.completed {
				.step-circle {
					background-color: #67c23a;
					color: #fff;
					border-color: #67c23a;
				}

				.step-line {
					background-color: #67c23a;
				}

				.step-text {
					color: #67c23a;
				}
			}
		}
	}

	.tab-container {
		display: flex;
		position: relative;

		.tab-item {
			flex: 1;
			display: flex;
			justify-content: center;
			align-items: center;
			height: 100rpx;
			font-size: 30rpx;
			color: #606266;
			position: relative;
			transition: all 0.3s ease;

			&.active {
				color: #333;
				font-weight: 500;
			}

			.tab-line {
				position: absolute;
				bottom: 0;
				left: 50%;
				transform: translateX(-50%);
				width: 60%;
				height: 6rpx;
				border-radius: 6rpx;
				transition: all 0.3s ease-in-out;
				opacity: 0;
				transform: translateX(-50%) scaleX(0);

				&.blue-line {
					background: linear-gradient(to right, #4080ff, #1890ff);
				}

				&.red-line {
					background: linear-gradient(to right, #ff6b6b, #ff4949);
				}

				&.green-line {
					background: linear-gradient(to right, #13c2c2, #36cfc9);
				}
			}

			&.active .tab-line {
				opacity: 1;
				transform: translateX(-50%) scaleX(1);
			}
		}
	}

	.content-wrapper {
		padding: 0;
	}

	.content-container {
		padding: 30rpx;
		animation: fade-in 0.3s ease;

		.content-title {
			display: flex;
			justify-content: center;
			align-items: center;
			margin-bottom: 20rpx;

			.title-line {
				width: 60rpx;
				height: 2rpx;
				background-color: #dcdfe6;
			}

			.title-text {
				font-size: 32rpx;
				color: #333;
				margin: 0 20rpx;
				font-weight: 500;
			}
		}

		.hint-text {
			font-size: 26rpx;
			color: #909399;
			text-align: center;
			margin-bottom: 30rpx;
		}

		.text-area-container {
			margin-bottom: 30rpx;

			.text-area {
				width: calc(100% - 40rpx);
				height: 240rpx;
				background-color: #f5f7fa;
				padding: 20rpx;
				font-size: 28rpx;
				color: #333;
				border-radius: 12rpx;

				&::placeholder {
					color: #a0a9b6;
				}
			}
		}

		.upload-container {
			// display: flex;
			// flex-wrap: wrap;
			margin-bottom: 30rpx;

			.upload-box {
				width: 180rpx;
				height: 180rpx;
				border: 2rpx dashed #dcdfe6;
				border-radius: 12rpx;
				display: flex;
				flex-direction: column;
				justify-content: center;
				align-items: center;
				background-color: #f5f7fa;
				transition: all 0.3s;
				margin-right: 20rpx;

				&:active {
					transform: scale(0.95);
				}

				.upload-icon {
					width: 60rpx;
					height: 60rpx;
					margin-bottom: 10rpx;
				}

				.upload-text {
					font-size: 24rpx;
					color: #909399;
				}
			}

			.image-preview {
				width: 180rpx;
				height: 180rpx;
				border-radius: 12rpx;
				position: relative;
				overflow: hidden;

				.preview-image {
					width: 100%;
					height: 100%;
				}

				.delete-icon {
					position: absolute;
					top: 0;
					right: 0;
					width: 40rpx;
					height: 40rpx;
					background-color: rgba(0, 0, 0, 0.5);
					color: #fff;
					border-radius: 0 0 0 12rpx;
					display: flex;
					justify-content: center;
					align-items: center;
					font-size: 28rpx;
				}
			}
		}

		.btn-group {
			display: flex;
			margin-top: 40rpx;

			.prev-btn {
				background-color: #f5f7fa;
				color: #606266;
				margin-right: 20rpx;
				border: 2rpx solid #ebeef5;
				flex: 1;
			}

			.next-btn {
				flex: 1;
			}
		}

		.next-btn,
		.prev-btn,
		.complete-btn {
			height: 90rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			border-radius: 45rpx;
			font-size: 30rpx;
			font-weight: 500;
			margin-top: 20rpx;
			transition: all 0.3s;

			&:active {
				transform: scale(0.98);
			}
		}

		.next-btn {
			background: linear-gradient(to right, #4080ff, #1890ff);
			color: #fff;
			box-shadow: 0 10rpx 20rpx rgba(24, 144, 255, 0.3);
		}

		.complete-btn {
			background: linear-gradient(to right, #13c2c2, #36cfc9);
			color: #fff;
			box-shadow: 0 10rpx 20rpx rgba(54, 207, 201, 0.3);
			flex: 2;
		}
	}

	.progress-container {
		border-bottom: 1rpx solid #f0f2f5;
		padding-bottom: 30rpx;
		margin-bottom: 30rpx;

		.progress-text {
			font-size: 28rpx;
			color: #606266;
			margin-bottom: 10rpx;
			font-weight: 500;
		}

		.progress-text-detail {
			font-size: 24rpx;
			color: #909399;
			margin-bottom: 15rpx;
		}

		.progress-bar {
			height: 16rpx;
			background-color: #f5f7fa;
			border-radius: 8rpx;
			overflow: hidden;
			margin-bottom: 20rpx;

			.progress-fill {
				height: 100%;
				background: linear-gradient(to right, #4080ff, #1890ff);
				border-radius: 8rpx;
				transition: width 0.3s;
			}
		}

		.progress-details {
			display: flex;
			flex-wrap: wrap;
			margin-top: 20rpx;

			.progress-item {
				display: flex;
				align-items: center;
				margin-right: 30rpx;
				margin-bottom: 15rpx;

				.progress-dot {
					width: 16rpx;
					height: 16rpx;
					border-radius: 8rpx;
					background-color: #c0c4cc;
					margin-right: 8rpx;
				}

				text {
					font-size: 24rpx;
					color: #909399;
				}

				&.completed {
					.progress-dot {
						background-color: #67c23a;
					}

					text {
						color: #67c23a;
					}
				}
			}
		}
	}

	.btn-container {
		display: flex;

		.btn {
			flex: 1;
			height: 90rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			border-radius: 45rpx;
			font-size: 30rpx;
			font-weight: 500;
			transition: all 0.3s;

			&:active {
				transform: scale(0.98);
			}

			&.cancel-btn {
				background-color: #f5f7fa;
				color: #606266;
				margin-right: 30rpx;
				border: 2rpx solid #ebeef5;
			}

			&.save-btn {
				background-color: #e6f7ff;
				color: #1890ff;
				border: 2rpx solid #91d5ff;
			}
		}
	}

	.modal {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background-color: rgba(0, 0, 0, 0.5);
		display: flex;
		justify-content: center;
		align-items: center;
		z-index: 999;

		.modal-content {
			width: 80%;
			background-color: #fff;
			border-radius: 16rpx;
			overflow: hidden;

			.modal-title {
				font-size: 32rpx;
				color: #333;
				font-weight: 500;
				padding: 30rpx;
				text-align: center;
				border-bottom: 2rpx solid #f0f0f0;
			}

			.modal-message {
				font-size: 28rpx;
				color: #606266;
				padding: 40rpx 30rpx;
				text-align: center;
			}

			.modal-btn {
				height: 90rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				font-size: 30rpx;
				color: #1890ff;
				border-top: 2rpx solid #f0f0f0;
				font-weight: 500;
			}
		}
	}
</style>